﻿using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Product.Domain.Services;
using SqlSugar;

namespace tianzedianzi.Controllers.Product
{
    public class ProductController : BaseController
    {
        private readonly ILogger<ProductController> _logger;
        private readonly ProductService _productService;
        private readonly IMapper _mapper;
        //private readonly IRestService _rest;
        public ProductController(ILogger<ProductController> logger, IMapper mapper, ProductService productService)
        {
            _logger = logger;
            _productService = productService;
            _mapper = mapper;
        }
        public IActionResult ProductIndex()
        {
            return View();
        }
        [HttpPost]
        public async Task<IActionResult> GetProductList(int page, int limit)
        {
            RefAsync<int> total = 0;
            var list = await _productService.GetProductPageListAsync(total, page, limit);
            return LayuiPageList(data: list, count: total);
        }
    }
}
